package com.tcoiss.webservice.controller.webapi;

import com.tcoiss.common.core.domain.R;
import com.tcoiss.common.core.web.controller.BaseController;
import com.tcoiss.common.log.annotation.ApiLog;
import com.tcoiss.common.log.annotation.Log;
import com.tcoiss.common.log.enums.BusinessType;
import com.tcoiss.webservice.domain.invoice.RecordCommonVo;
import com.tcoiss.webservice.service.IInvoiceService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 发票API接口
 */
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/invoice")
public class InvoiceApiController extends BaseController {
    private final IInvoiceService iInvoiceService;

    //@Log(title = "发票开具" , businessType = BusinessType.EXECUTE_API)
    @PostMapping("/issueInvoice")
    public R issueInvoice(@RequestBody RecordCommonVo vo) {

        return iInvoiceService.issueInvoice(vo);
    }

    //@Log(title = "电子发票开具" , businessType = BusinessType.EXECUTE_API)
    @PostMapping("/DzIssueInvoice")
    public R DzIssueInvoice(@RequestBody RecordCommonVo vo) {
        return iInvoiceService.dzIssueInvoice(vo);
    }


    //@Log(title = "电子发票查询" , businessType = BusinessType.EXECUTE_API)
    @PostMapping("/DzQueryInvoice")
    public R DzQueryInvoice(@RequestBody RecordCommonVo vo) {
        return iInvoiceService.dzQueryInvoice(vo);
    }

    //@Log(title = "电子发票红字申请接口" , businessType = BusinessType.EXECUTE_API)
    @PostMapping("/DzRedInvoice")
    public R DzRedInvoice(@RequestBody RecordCommonVo vo) {
        return iInvoiceService.dzRedInvoice(vo);
    }

    //@Log(title = "电子发票红字查询接口" , businessType = BusinessType.EXECUTE_API)
    @PostMapping("/DzRedQueryInvoice")
    public R DzRedQueryInvoice(@RequestBody RecordCommonVo vo) {
        return iInvoiceService.dzRedQueryInvoice(vo);
    }

    //@Log(title = "发票打印" , businessType = BusinessType.EXECUTE_API)
    @PostMapping("/printInvoice")
    public R printInvoice(@RequestBody RecordCommonVo vo) {

        return iInvoiceService.printInvoice(vo);
    }

    //@Log(title = "发票作废" , businessType = BusinessType.EXECUTE_API)
    @PostMapping("/invalidInvoice")
    public R invalidInvoice(@RequestBody RecordCommonVo vo) {

        return iInvoiceService.invalidInvoice(vo);
    }


    //@Log(title = "发票开具测试接口" , businessType = BusinessType.EXECUTE_API)
    @PostMapping("/issueInvoiceTest")
    public R issueInvoiceTest(@RequestBody RecordCommonVo vo) {

        return iInvoiceService.issueInvoiceTest(vo);
    }

    //@Log(title = "发票打印接口" , businessType = BusinessType.EXECUTE_API)
    @PostMapping("/printInvoiceTest")
    public R printInvoiceTest(@RequestBody RecordCommonVo vo) {

        return iInvoiceService.printInvoiceTest(vo);
    }

    //@Log(title = "发票作废接口" , businessType = BusinessType.EXECUTE_API)
    @PostMapping("/invalidInvoiceTest")
    public R invalidInvoiceTest(@RequestBody RecordCommonVo vo) {

        return iInvoiceService.invalidInvoiceTest(vo);
    }

}
